<html>
<header>
    <style>* { -webkit-tap-highlight-color: rgba(0,0,0,0);} img {width:100%;height:100%} body {margin: 0;padding: 0}</style>
    <script type="text/javascript" >

        function initAd() {
            var clkUrl = {{.clickUrl}};
            var imgUrls = {{.AD.imgUrls}};

            var len = imgUrls.length;
            if (len > 0) {
                var imgDiv = document.getElementById("adImgDiv");
                var img = document.createElement("img");
                imgDiv.appendChild(img);
                img.src = imgUrls[0];

                img.onclick = function(){
                    trackingLoaded(clkTrackingUrls);
                    window.location.href = clkUrl;
                }
            }
        }
        function trackingLoaded(trackingUrls) {
            if (trackingUrls) {
                var len = trackingUrls.length;
                var trackingDiv = document.getElementById("trackingDiv");
                for (var i = 0; i < len; i++) {
                    var frm = document.createElement("iframe");
                    trackingDiv.appendChild(frm);
                    frm.width = 0;
                    frm.height = 0;
                    frm.frameBorder = 0;
                    frm.src = trackingUrls[i];
                }
            }
        }

        window.onload =initAd;
    </script>
</header>
<body>
    <div id="adImgDiv" width={{.width}} height={{.height}}>
    </div>
    <div id="trackingDiv" style="top:0;left:0;width:0;height:0">
        {{range .AD.implTrackingUrls}}
        <img src="{{.}}" />
        {{end}}
    </div>
</body>
</html>